package jp.sourceforge.akjrcp.videotools.muxsubtitle;

import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;


import org.apache.commons.io.FileUtils;

import jp.sourceforge.akjrcp.ffmpeg.FFMpegFLVFileEffector;

public class SubtitleFLVFileEffector extends FFMpegFLVFileEffector{

	int index=0;
	public SubtitleFLVFileEffector(String ffmpegPath, File input, File output) {
		super(ffmpegPath, input, output);
		// TODO Auto-generated constructor stub
	}

	public void effect(File inputFile, File outputFile) {
		int x=index*10/30;
		// TODO Auto-generated method stub
		try {
			BufferedImage bimage=ImageIO.read(inputFile);
			Graphics2D g=(Graphics2D) bimage.getGraphics();
			g.drawString("I Love You", x, 32);
			ImageIO.write(bimage, "jpg", outputFile);
			//FileUtils.copyFile(inputFile, outputFile);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		index++;
	}

}
